package com.example.View.Renderers;

import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;

import com.example.View.Projection;
import com.example.util.Figure;

public abstract class FigureRendererBase implements FigureRenderer {

    private Resources resources;

    /**
     * Constructs a FigureRendererBase
     */
    protected FigureRendererBase(Resources resources) {
        this.resources = resources;
    }

    /**
     * Renders a given figure
     * @param canvas The canvas on which (and using which) this figure is rendered
     * @param projection The translation between the model coordinate system and the view coordinate system.
     * @param figure The figure to be rendered.
     */
    public abstract void render(Canvas canvas, Projection projection, Figure figure);
    
    protected Bitmap createBitmap(int id) {
        return BitmapFactory.decodeResource(resources, id);
    }
}
